package com.wn.controller;

import com.wn.entity.Train;
import com.wn.utils.Station;
import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONObject;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@Slf4j
@RequestMapping("Train")
@RestController
public class TrainController {

    @PostMapping("train")
    public Object train(@RequestBody Train train) throws Exception{
        System.out.println("--------------------");
        JSONObject get = Station.Get(train.getStart(), train.getEnd(), train.getDate());
        log.info(get.toString());
        return get.toString();
    }
}
